package perf.graph.format;

import java.text.DecimalFormat;

import org.apache.commons.collections15.Transformer;

import perf.graph.Vertex;

public class VertexLabelTransformer implements Transformer<Vertex, String> {

	public static String percentFormat( float num ) {
		DecimalFormat df = new DecimalFormat( "##0.000" );
		return df.format( num );
	}
	
	public String transform(Vertex vertex) {
		float percent = vertex.getCostPercent();
		
		
		return "<html><center>" + vertex.getLabel()
			+ "<br/>" + VertexLabelTransformer.percentFormat( percent )
			+ "<br/>" + vertex.getPath() + "</center></html>";
	}
}
